package com.aaa.mbs.controller;

import com.aaa.common.util.Result;
import com.aaa.common.util.ResultStatus;
import com.aaa.mbs.entity.AccountStatement;
import com.aaa.mbs.service.AccountStatementService;
import com.aaa.mbs.vo.LoginLogShow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: Bug Maker
 * @date: 2021/2/23 18:20
 * @description:
 */
@RestController
@RequestMapping("/account")
public class AccountStatementController {
    @Autowired
    private AccountStatementService accountStatementService;

    @GetMapping("/incomeRecord")
    public Result<List<AccountStatement>> getIncomeRecord(String yearMonth){
        List<AccountStatement> list = accountStatementService.selectIncomeShow(yearMonth);
        return new Result<>(200,"success",list);
    }
    @GetMapping("/loginLog")
    public Result<List<LoginLogShow>> getLoginLog(String yearMonth){
        return new Result<>(200,"success",accountStatementService.selectLoginLog(yearMonth));
    }

    /**
     * 功能描述:用户充值添加订单，修改余额
     * @param accountStatement accountStatement
     * @return com.aaa.common.util.Result<com.aaa.mbs.entity.AccountStatement>
     */
    @PostMapping("addMoney")
    public Result<AccountStatement> addMoney(@RequestBody AccountStatement accountStatement){
        System.out.println(accountStatement);
        return new Result<>(ResultStatus.SUCCESS.getCode(),
                ResultStatus.SUCCESS.getMessage(),
                this.accountStatementService.addMoney(accountStatement));
    }
}
